#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>      
#include <string.h>
#include <assert.h>
int my_atoi(const char* s)
{
	assert(s);
	int num = 0;
	int flag = 1;
	char* p = s;
	while (*p == ' ')
	{
		p++;
	}
	while (p)
	{
		if (*p == '-'&&flag==1)
		{
			flag = -1;
			p++;
		}
		if (isdigit(*p))
		{
			num = num * 10 + *p - '0';
		}
		else
		{
			break;
		}
		p++;
	}
	num *= flag;
	return num;
}
int main()
{
	char s[] = "--123 567";
	int ret1=my_atoi(s);
	int ret2 = atoi(s);
	printf("%d\n%d", ret1,ret2);
	return 0;
}